<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
	<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Cousine|Inconsolata" rel="stylesheet">
	<link rel="shortcut icon" type="image/png" href="/favicon.png">

	
	<link rel="stylesheet" href="/css/style.css">
	<link rel="stylesheet" href="/css/css/fontawesome-all.min.css">
	<script src="/js/main.js"></script>
	

	<!-- Begin Jekyll SEO tag v2.1.0 -->
<title>RB: Submit Comment Reply - Steem Developer</title>
<meta property="og:title" content="RB: Submit Comment Reply" />
<meta name="description" content="By the end of this tutorial you should know how to prepare comments for Steem and then submit using Radiator" />
<meta property="og:description" content="By the end of this tutorial you should know how to prepare comments for Steem and then submit using Radiator" />
<link rel="canonical" href="https://developer.steem.io/tutorials-ruby/submit_comment_reply" />
<meta property="og:url" content="https://developer.steem.io/tutorials-ruby/submit_comment_reply" />
<meta property="og:site_name" content="Steem Developer" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-07-20T12:56:08-05:00" />
<script type="application/ld+json">
{"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "RB: Submit Comment Reply",
"datePublished": "2018-07-20T12:56:08-05:00",
"description": "By the end of this tutorial you should know how to prepare comments for Steem and then submit using Radiator",
"url": "https://developer.steem.io/tutorials-ruby/submit_comment_reply"}</script>
<!-- End Jekyll SEO tag -->


	
</head>
<body>
<header>
	<h1>
		<button type="button" class="open-nav" id="open-nav"></button>
		<a href="/"  class="logo-link"><img src="/images/logotype_white.svg" height="40" alt="Steem Developer logo"></a>
	</h1>

	
	<form action="/search/" method="get">
		<input type="text" name="q" id="search-input" placeholder="Search">
		<input type="submit" value="Search" style="display: none;">
	</form>
	

	<div id="sidebar" class="sidebar">
	
	
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/">
		<h6 class="ctrl-nav-section title">Introduction</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/#introduction-welcome">Welcome to Steem</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/quickstart/">
		<h6 class="ctrl-nav-section title">Quickstart</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/quickstart/#quickstart-choose-library">Choose Library</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-steemd-nodes">steemd Nodes</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-testnet">Steem Testnet</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/tutorials/">
		<h6 class="ctrl-nav-section title">Tutorials</h6>
		<ul class="cont-nav-section content">
			
				
					
						<li><a href="/tutorials/#tutorials-javascript">Javascript</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-python">Python</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-ruby">Ruby</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-recipes">Recipes</a></li>
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/services/">
		<h6 class="ctrl-nav-section title">Services</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/services/#services-steemit">Steemit.com</a></li>
						
					
						
						<li><a href="/services/#services-steemconnect">SteemConnect</a></li>
						
					
						
						<li><a href="/services/#services-jussi">jussi</a></li>
						
					
						
						<li><a href="/services/#services-imagehoster">ImageHoster</a></li>
						
					
						
						<li><a href="/services/#services-sbds">SBDS</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/apidefinitions/">
		<h6 class="ctrl-nav-section title">Appbase API</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/apidefinitions/#apidefinitions-condenser-api">Condenser Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-by-key-api">Account By Key Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops-comment">Broadcast Ops Comment</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-history-api">Account History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-database-api">Database Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-follow-api">Follow Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-jsonrpc">Jsonrpc</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-market-history-api">Market History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-network-broadcast-api">Network Broadcast Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-tags-api">Tags Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-witness-api">Witness Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-block-api">Block Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops">Broadcast Ops</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/community/">
		<h6 class="ctrl-nav-section title">Community</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/community/#community-overview">Overview</a></li>
						
					
						
						<li><a href="/community/#community-resources">Resources</a></li>
						
					
						
						<li><a href="/community/#community-developeradvocate">Sharing & Help</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/glossary/">
		<h6 class="ctrl-nav-section title">Glossary</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/glossary/#glossary-chain-basics">Chain Basics</a></li>
						
					
						
					
						
						<li><a href="/glossary/#glossary-governance">Governance</a></li>
						
					
						
						<li><a href="/glossary/#glossary-transactions">Transactions</a></li>
						
					
						
						<li><a href="/glossary/#glossary-api">API</a></li>
						
					
						
						<li><a href="/glossary/#glossary-market">Market</a></li>
						
					
				
			
		</ul>
	</section>
	
</div>


	<!--<p class="copyright">-->
	<!--<a href="https://steemit.com.com/">-->
	<!--steemit-->
	<!--</a>-->
	<!--</p>-->
	<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
</header>
<div class="main" id="top">
	<div class="hero">
		<h1 class="hero__h1">Steem Developer Portal </h1>
		
		<img class="hero__img" src="/images/hero.png">
		
	</div>
	<section id="tutorials-ruby-submit-comment-reply" class="row tutorials-ruby-submit-comment-reply">
	<h3>
		<a id="tutorials-ruby-submit-comment-reply">
			RB: Submit Comment Reply
			
		</a>
	</h3>
	
		<p class="description">By the end of this tutorial you should know how to prepare comments for Steem and then submit using Radiator</p>
	

	<p><span class="fa-pull-left top-of-tutorial-repo-link"><span class="first-word">Full</span>, runnable src of <a href="https://github.com/steemit/devportal-tutorials-rb/tree/master/tutorials/11_submit_comment_reply">Submit Comment Reply</a> can be downloaded as part of the <a href="https://github.com/steemit/devportal-tutorials-rb">RB tutorials repository</a>.</span>
<br /></p>

<h3 id="intro">Intro</h3>

<p>This example will broadcast a reply to the blockchain using the values provided.  To create a post in <code class="highlighter-rouge">ruby</code>, we will use a <code class="highlighter-rouge">Radiator::Transaction</code> containing a <code class="highlighter-rouge">comment</code> operation, which is how all content is stored internally.</p>

<p>A reply is differentiated from a post by whether or not a <code class="highlighter-rouge">parent_author</code> exists. When there is no <code class="highlighter-rouge">parent_author</code>, then it’s a post, otherwise it’s a comment (like in this example).</p>

<h3 id="script">Script</h3>

<p>You should change <code class="highlighter-rouge">wif</code> to the posting key that matches your <code class="highlighter-rouge">author</code>.  This script will pass along the values as a <a href="https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_comment"><code class="highlighter-rouge">comment</code> operation</a>:</p>

<ul>
  <li><code class="highlighter-rouge">author</code> - Account name of the author currently replying.</li>
  <li><code class="highlighter-rouge">permlink</code> - Value unique to the author</li>
  <li><code class="highlighter-rouge">parent_author</code> - The name of the author of the being replied to, in the case of a reply like this example.</li>
  <li><code class="highlighter-rouge">parent_permlink</code> - The permlink of the content being replied to, in the case of a reply like this example.</li>
  <li><code class="highlighter-rouge">title</code> - Typically empty.</li>
  <li><code class="highlighter-rouge">body</code> - The actual content of the post.</li>
  <li><code class="highlighter-rouge">json_metadata</code> - JSON containing the <code class="highlighter-rouge">parent_permlink</code> of the root post as a tags array.</li>
</ul>

<h3 id="to-run">To Run</h3>

<p>First, set up your workstation using the steps provided in <a href="https://developers.steem.io/tutorials-ruby/getting_started">Getting Started</a>.  Then you can create and execute the script (or clone from this repository):</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>git clone git@github.com:steemit/devportal-tutorials-rb.git
<span class="nb">cd </span>devportal-tutorials-rb/tutorials/11_submit_comment_reply
bundle install
ruby submit_comment_reply.rb
</code></pre>
</div>

<h3 id="example-output">Example Output</h3>

<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nt">"jsonrpc"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2.0"</span><span class="p">,</span><span class="w">
  </span><span class="nt">"result"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nt">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"3fef14cac921e9baa7b31e43245e5380f3fb4332"</span><span class="p">,</span><span class="w">
    </span><span class="nt">"block_num"</span><span class="p">:</span><span class="w"> </span><span class="mi">23355115</span><span class="p">,</span><span class="w">
    </span><span class="nt">"trx_num"</span><span class="p">:</span><span class="w"> </span><span class="mi">13</span><span class="p">,</span><span class="w">
    </span><span class="nt">"expired"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nt">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>

<p>The response we get after broadcasting the transaction gives us the transaction id (<a href="https://steemd.com/tx/3fef14cac921e9baa7b31e43245e5380f3fb4332"><code class="highlighter-rouge">3fef14c...</code></a>), block number (<a href="https://steemd.com/b/23355115"><code class="highlighter-rouge">22867626</code></a>), and the transaction number of that block (<code class="highlighter-rouge">13</code>).</p>

<h4 id="error-handling">Error Handling</h4>

<p>We’re checking the result for <code class="highlighter-rouge">error</code> in case the remote node has an issue to raise.  Normally, it will be <code class="highlighter-rouge">nil</code>, but if it’s populated, output <code class="highlighter-rouge">error.message</code> and exit.</p>

<hr />

</section>

</div>
<div class="footer">
	<a href="#">Back to top</a>
</div>
<script>
    document.getElementById("open-nav").addEventListener("click", function () {
        document.body.classList.toggle("nav-open");
    });
</script>
</body>
</html>


<script src="/js/adjust.js"></script>

